
// 音量按钮
var a=1;
var b=1;
function volume(){
    a++;
    if(a%2==0){
        document.getElementById("volume-wrap").style.display="block";
        // g++;
    }else{
        document.getElementById("volume-wrap").style.display="none";
    }  
    // console.log(a); 
}

// 歌词歌单按钮
function list(){
    b++;
    if(b%2==0){
        document.getElementById("songlist-wrap").style.display="block";
    }else{
        document.getElementById("songlist-wrap").style.display="none";
    }
    // console.log();
}

// 歌词歌单的关闭按钮
function listclose(){
    document.getElementById("songlist-wrap").style.display="none";
    b++;
    // console.log(b);
}

var songData=[
    {
        songname:'海阔天空',
        singer:'Beyond',
        songsrc:'./music/1.mp3',
        sonttime:'05:24',
        songimg:'./music/imgages/1.jpg',
    },
    {
        songname:'一路向北',
        singer:'周杰伦',
        songsrc:'./music/2.mp3',
        sonttime:'04:55',
        songimg:'./music/imgages/2.jpg',
    },
    {
        songname:'珊瑚海',
        singer:'周杰伦/Lara梁心颐',
        songsrc:'./music/3.mp3',
        sonttime:'04:16',
        songimg:'./music/imgages/3.jpg',
    },
    {
        songname:'交换余生',
        singer:'林俊杰',
        songsrc:'./music/4.mp3',
        sonttime:'04:36',
        songimg:'./music/imgages/4.jpg',
    }
];

// 歌词列表左边红色按钮
function songnameclick2(){
    timer=setInterval(gressTime,1000);
    document.getElementById("col-1").style.visibility="hidden";
    document.getElementById("li1").style.background="";

    document.getElementById("col-2").style.visibility="visible";
    document.getElementById("li2").style.background="#000";

    document.getElementById("col-3").style.visibility="hidden";
    document.getElementById("li3").style.background="";

    document.getElementById("col-4").style.visibility="hidden";
    document.getElementById("li4").style.background="";
    // 歌词背景
    document.getElementById("lyric-imgbg").style.backgroundImage="url(./music/imgages/2.jpg)";
    var imghead=document.getElementById("songhead");
    imghead.src='./music/imgages/2.jpg';
    document.getElementById("audio").src=songData[1].songsrc;
    document.getElementById("audio").play();
    document.getElementById("play").className="player";
    document.getElementById("song-name").innerText="一路向北";
    document.getElementById("song-singer").innerText="周杰伦(Jay Chou)";
    // document.getElementById("nowdurtime").innerText=songData[2].sonttime; 
    s=false;
    t=1;
    O=t;
}

function songnameclick3(){
    timer=setInterval(gressTime,1000);
    document.getElementById("col-1").style.visibility="hidden";
    document.getElementById("li1").style.background="";

    document.getElementById("col-3").style.visibility="visible";
    document.getElementById("li3").style.background="#000";

    document.getElementById("col-2").style.visibility="hidden";
    document.getElementById("li2").style.background="";

    document.getElementById("col-4").style.visibility="hidden";
    document.getElementById("li4").style.background="";
    // 歌词背景
    document.getElementById("lyric-imgbg").style.backgroundImage="url(./music/imgages/3.jpg)";
    var imghead=document.getElementById("songhead");
    imghead.src='./music/imgages/3.jpg';
    document.getElementById("audio").src=songData[2].songsrc;
    document.getElementById("audio").play();
    document.getElementById("play").className="player";
    document.getElementById("song-name").innerText="珊瑚海";
    document.getElementById("song-singer").innerText="周杰伦/Lara梁心颐";
    // document.getElementById("nowdurtime").innerText=songData[3].sonttime; 
    s=false;
    t=2;
    O=t;
}

function songnameclick4(){
    timer=setInterval(gressTime,1000);
    document.getElementById("col-1").style.visibility="hidden";
    document.getElementById("li1").style.background="";

    document.getElementById("col-4").style.visibility="visible";
    document.getElementById("li4").style.background="#000";

    document.getElementById("col-3").style.visibility="hidden";
    document.getElementById("li3").style.background="";

    document.getElementById("col-2").style.visibility="hidden";
    document.getElementById("li2").style.background="";
    // 歌词背景
    document.getElementById("lyric-imgbg").style.backgroundImage="url(./music/imgages/4.jpg)";
    var imghead=document.getElementById("songhead");
    imghead.src='./music/imgages/4.jpg';
    document.getElementById("audio").src=songData[3].songsrc;
    document.getElementById("audio").play();
    document.getElementById("play").className="player";
    document.getElementById("song-name").innerText="交换余生";
    document.getElementById("song-singer").innerText="林俊杰";
    // document.getElementById("nowdurtime").innerText=songData[4].sonttime; 
    s=false;
    t=3;
    O=t;
}

// 加载事件

// 播放模式按钮
var cur=1;
// function typeicn(){
//     var btn=document.getElementById("typeicn");
//     var arr=new Array();
//     arr[0]="-66px -248px";//随机
//     arr[1]="-66px -344px";//单曲
//     arr[2]="-3px -344px";//循环  
    
//     var bg=["-93px -248px","-93px -344px","-33px -344px"];

//     // arr[0]=;//随机高亮
//     // arr[1]=;//单曲高亮
//     // arr[2]=;//循环高亮
//     if(cur==arr.length){
//         cur=0;
//         btn.style.backgroundPosition=bg[0];
//         btn.onmouseover=function(){
//             btn.style.backgroundPosition=bg[0];
//         }
//         btn.onmouseout=function(){
//             btn.style.backgroundPosition=arr[0];
//         }
//     }else{
//         cur;
//         btn.style.backgroundPosition=bg[cur];
//         btn.onmouseover=function(){
//             btn.style.backgroundPosition=bg[cur];
//         }
//         btn.onmouseout=function(){
//             cur;
//             btn.style.backgroundPosition=arr[cur];
//         }
//     }
//     cur+=1;
// }

// 底部播放栏的浮动效果
/*
transform- classname-style-mouseover-mousemove[hd-bar]
*/
function typeicn(){
    cur++;
    if(cur>3){
        cur=1;
        document.getElementById("typeicn").className="typeicn";
    }else{
        switch(cur){
            case 2:document.getElementById("typeicn").className="typeicn1";
            break;
            case 3:document.getElementById("typeicn").className="typeicn2";
            break;
            default:document.getElementById("typeicn").className="typeicn";
        }
    }
}

//播放栏分享按钮的弹出菜单
var y=false;
function showwrap(){
    if(y==false){
        document.getElementById("share-wrap").style.display="block";
        y=true;
    }else{
        document.getElementById("share-wrap").style.display="none";
        y=false;
    }
}

function shareclose(){
    document.getElementById("share-wrap").style.display="none";
    y=false;
}

// 播放栏的锁定和解锁
var g=2;
// console.log(a);
function lockbtn(){
    var songlist=document.getElementById("songlist-wrap");
    var playbar=document.getElementById("playerbar");
    var lock=document.getElementById("lockbtn");
    var lockbar=document.getElementById("lock-bar");
    var volume=document.getElementById("volume-wrap");

    // g++;
    if(g%2==0){
        g++;
        // console.log(g);
        if(songlist.style.display="block"){
            document.getElementById("volume-wrap").style.display="none";
            // a++;
            b++;
            songlist.style.display="none";
            playbar.style.bottom="-45px";
            lockbar.style.bottom="0px";
            lock.style.backgroundImage='url(./images/locked-hover.png)';
            lock.style.width="13px";
            lock.style.height="13px";
            lock.onmouseout=function(){
                lock.style.backgroundImage='url(./images/locked.png)';
                lock.style.margin="7px 0 0 20px";
            }
            lock.onmouseover=function(){
                lock.style.width="15px";
                lock.style.height="14px";
                lock.style.backgroundImage='url(./images/locked-hover.png)';
                lock.style.margin="5px 0 0 18px";
            }
            // console.log(songlist.style.display);
        }else{
            playbar.style.bottom="-45px";
            lockbar.style.bottom="0px";
            lock.style.backgroundImage='url(./images/locked-hover.png)';
            lock.style.width="13px";
            lock.style.height="13px";
            lock.onmouseout=function(){
                lock.style.backgroundImage='url(./images/locked.png)';
                lock.style.margin="7px 0 0 20px";
            }
            lock.onmouseover=function(){
                lock.style.width="15px";
                lock.style.height="14px";
                lock.style.backgroundImage='url(./images/locked-hover.png)';
                lock.style.margin="5px 0 0 18px"
            }
        }
        // console.log(g);
    }else{
        playbar.style.bottom="0";
        lockbar.style.bottom="45px";
        lock.style.backgroundImage='url(./images/lock-hover.png)';
        lock.style.width="10px";
        lock.style.height="10px";
        lock.onmouseout=function(){
            lock.style.backgroundImage='url(./images/lock.png)';
            lock.style.margin="8px 0 0 20px";
            lock.style.width="10px";
            lock.style.height="10px";
        }
        lock.onmouseover=function(){
            lock.style.backgroundImage='url(./images/lock-hover.png)';
            lock.style.margin="6px 0 0 18px";
            lock.style.width="13px";
            lock.style.height="13px";
        }
        // console.log(a);
        if(b%2==0){
            songlist.style.display="none";
        }
        else{
            songlist.style.display="block";
        }
        b++;
        // a++;
        g++;
    }
    
}

// 底部播放栏的浮动栏效果